import java.util.Scanner;

/**
 * @author gao
 * @date 2025/10/8 17:58
 */

public class Solution {
    public boolean judgeSquareSum(int c) {
        long left = 0, right = (long) Math.sqrt(c);
        while (left <= right) {
            long ret = left * left + right * right;
            if (ret > c) {
                right--;
            } else if (ret < c) {
                left++;
            } else {
                return true;
            }
        }
        return false;
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        while (in.hasNext()) {
            int c = in.nextInt();
            Solution solution = new Solution();
            System.out.println(solution.judgeSquareSum(c));
        }
    }
}